class CustomStack(object):

    def __init__(self, maxSize):
        """
        :type maxSize: int
        """
        self.st = [0] * maxSize
        self.maxSize = maxSize
        self.index = 0

    def push(self, x):
        """
        :type x: int
        :rtype: None
        """
        if self.index < self.maxSize:
            self.st[self.index] = x
            self.index += 1

    def pop(self):
        """
        :rtype: int
        """
        if self.index > 0:
            self.index -= 1
            return self.st[self.index]
        else:
            return -1

    def increment(self, k, val):
        """
        :type k: int
        :type val: int
        :rtype: None
        """
        for i in range(min(k, self.index)):
            self.st[i] += val
